# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

include_guard(DIRECTORY)

function(fairseq2n_print_project_summary)
    message(STATUS "")
    message(STATUS "******************** Summary ********************")
    message(STATUS "  CMake Version                      : ${CMAKE_VERSION}")
    message(STATUS "  CMake Command                      : ${CMAKE_COMMAND}")
    message(STATUS "  System                             : ${CMAKE_SYSTEM_NAME}")
    message(STATUS "  C++ Compiler                       : ${CMAKE_CXX_COMPILER}")
    message(STATUS "  C++ Compiler Version               : ${CMAKE_CXX_COMPILER_VERSION}")
    message(STATUS "  Python Version                     : ${Python3_VERSION}")
    message(STATUS "  Python Interpreter                 : ${Python3_EXECUTABLE}")
    message(STATUS "  Torch Version                      : ${TORCH_VERSION}")
    message(STATUS "  Torch Library                      : ${TORCH_LIBRARY}")
    message(STATUS "  Build Type                         : ${CMAKE_BUILD_TYPE}")
    message(STATUS "")
    message(STATUS "  PROJECT_VERSION                    : ${PROJECT_VERSION}")
    message(STATUS "  FAIRSEQ2N_BUILD_FOR_NATIVE         : ${FAIRSEQ2N_BUILD_FOR_NATIVE}")
    message(STATUS "  FAIRSEQ2N_INSTALL_STANDALONE       : ${FAIRSEQ2N_INSTALL_STANDALONE}")
    message(STATUS "  FAIRSEQ2N_PERFORM_LTO              : ${FAIRSEQ2N_PERFORM_LTO}")
    message(STATUS "  FAIRSEQ2N_RUN_CLANG_TIDY           : ${FAIRSEQ2N_RUN_CLANG_TIDY}")
    if(FAIRSEQ2N_RUN_CLANG_TIDY)
        message(STATUS "    clang-tidy                       : ${CLANG_TIDY_EXECUTABLE}")
    endif()
    if(NOT FAIRSEQ2N_SANITIZERS OR FAIRSEQ2N_SANITIZERS STREQUAL "nosan")
        message(STATUS "  FAIRSEQ2N_SANITIZERS               : -")
    else()
        message(STATUS "  FAIRSEQ2N_SANITIZERS               : ${FAIRSEQ2N_SANITIZERS}")
    endif()
    message(STATUS "  FAIRSEQ2N_TREAT_WARNINGS_AS_ERRORS : ${FAIRSEQ2N_TREAT_WARNINGS_AS_ERRORS}")
    message(STATUS "  FAIRSEQ2N_SUPPORT_IMAGE            : ${FAIRSEQ2N_SUPPORT_IMAGE}")
    message(STATUS "  FAIRSEQ2N_USE_LIBTORCH             : ${FAIRSEQ2N_USE_LIBTORCH}")
    message(STATUS "  FAIRSEQ2N_USE_CUDA                 : ${FAIRSEQ2N_USE_CUDA}")
    if(FAIRSEQ2N_USE_CUDA)
        message(STATUS "    CUDA Version                     : ${CUDAToolkit_VERSION}")
        message(STATUS "    CUDA NVCC                        : ${CUDAToolkit_NVCC_EXECUTABLE}")
        message(STATUS "    CUDA Architectures               : ${CMAKE_CUDA_ARCHITECTURES}")
    endif()
    message(STATUS "  FAIRSEQ2N_BUILD_PYTHON_BINDINGS    : ${FAIRSEQ2N_BUILD_PYTHON_BINDINGS}")
    if(FAIRSEQ2N_BUILD_PYTHON_BINDINGS)
        message(STATUS "  FAIRSEQ2N_PYTHON_DEVEL             : ${FAIRSEQ2N_PYTHON_DEVEL}")
    endif()
    message(STATUS "")
    message(STATUS "  System Dependencies")
    if(FAIRSEQ2N_THREAD_LIB STREQUAL "tbb")
        message(STATUS "    Intel oneTBB                     : ${TBB_VERSION}")
    endif()
    message(STATUS "    libsndfile                       : ${SndFile_VERSION}")
    message(STATUS "")
endfunction()
